<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
            body{
                position: relative;
            }
            .box{
                width: 100px;
                height: 100px;
                background: skyblue;
                position: absolute;
    
            }
        </style>
    </head>
    <body>
            <input type="button" value="开始" id="btn">
            <div class="box"></div>
            <script>
                function $(ele){
                    return document.querySelector(ele);
                }
                let speed=1;
                $('#btn').onclick=function(){
                    let time=setInterval(function(){
                        speed+=$('.box').offsetLeft/100;
                        if($('.box').offsetLeft>=1000){
                            clearInterval(time);
                        }else{
                            $('.box').style.left=$('.box').offsetLeft+speed+'px';
                        }
                    },20)
                }
            </script>
</body>
</html>